<template>
	<view class="container">
		<view class="yun-bg">
			<view class="yunbi">余额</view>
			<view class="money">{{money}}</view>
			<view class="tixian" @click="gotixian">提现</view>
		</view>
		<view class="record_box">
			<view class="record">余额账单</view>
			<view class="record_item">
				<view class="left">时间</view>
				<view class="middle">来源</view>
				<view class="right">数量</view>
			</view>
			<view class="record_time" v-for="(item,index) in billList">
				<view class="left">{{$u.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM')}}</view>
				<view class="middle">{{item.describe}}</view>
				<view class="right success_text"><text >{{item.remark}}</text>{{item.money}}</view>
			</view>
		</view>
	</view>
</template>
<script>
	import {getPageTask} from "../../../api/user.js"
	export default{
		data(){
			return{
				billList:[],
				money:'',
				num:0,
				type:2
			}
		},
		onLoad(e) {
			if(e.type){
				uni.setNavigationBarTitle({
				    title: '释放余额'
				});
				this.type=4
			}
		},
		onShow() {
			this.getyunbiList();
			this.getmoney();
		},
		onReachBottom() {
			this.getyunbiList();
		},
		methods:{
			gotixian(){
				uni.navigateTo({
					url:"/pages/transfer/tixian"
				})
			},
			getyunbiList(){
				this.num++
				this.get(getPageTask,{type:this.type,pageNum:this.num,pageSize:20}).then(res=>{
					console.log(res);
					res.data.accountList.list.forEach(item=>{
						this.billList.push(item)
					})
					this.money=res.data.money
				})
			},
			getmoney(){
				this.get(getPageTask,{type:this.type,pageNum:1,pageSize:10}).then(res=>{
					console.log(res);
					this.money=res.data.money
				})
			},
			
		}
	}
</script>

<style>
	.container{
		padding: 30rpx 30rpx;
	}
	.yun-bg{
		height: 300rpx;
		width: 690rpx;
		background: url("../../../static/user/yun/yunbi_bg.png") no-repeat;
		background-size: 100% 100%;
		color: #FFFFFF;
		padding-top: 50rpx;
	}
	.yunbi{
		font-size: 28rpx;
		font-weight: 400;
		margin-left: 40rpx;
	}
	.money{
		font-size: 48rpx;
		font-weight: bold;
		margin-top: 20rpx;
		margin-left: 40rpx;
	}
	.tixian{
		width: 227rpx;
		height: 60rpx;
		background: #FFFFFF;
		border-radius: 30rpx;
		margin-top: 23rpx;
		margin-left: 33rpx;
		text-align: center;
		line-height: 60rpx;
		font-size: 26rpx;
		color: #000000;
	}
	.record_box{
		width: 100%;
	}
	.record{
		margin-top: 40rpx;
		font-size: 32rpx;
		font-weight: 800;
		color: #333333;
	}
	.record_item{
		display: flex;
		align-items: center;
		justify-content: space-between;
		font-size: 30rpx;
		color: #666666;
		margin-top: 30rpx;
		width: 100%;
	}
	.left{
		/* width: 590rpx; */
		width: 35%;
	}
	.middle{
		width: 50%;
		text-align: center;
	}
	.right{
		/* width: 100rpx; */
		width: 15%;
		text-align: right;
	}
	.record_time{
		display: flex;
		align-items: center;
		justify-content: space-between;
		font-size: 28rpx;
		color: #666666;
		margin-top: 30rpx;
	}
	.success_text{
		font-size: 20rpx;
		color: #F0812D;
	}
</style>
